import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableNativeFeedback
} from 'react-native';
/**
 * 由 WangYu 创建
 * 日期 2017/10/12
 */
export default class ItemView extends Component {
    static defaultProps = {
        title: '默认标题',
        right:'',
    };

    constructor(props) {
        super(props);
    }

    render() {
        return (
            <TouchableNativeFeedback onPress={this.props.onPress}>
                <View style={[styles.container,this.props.style]}>
                    {this.props.icon?<Image style={{width:25,height:25,marginRight:8}} source={this.props.icon}/>:null}
                    <Text style={{flex: 1}}>{this.props.title}</Text>
                    <Text style={{marginRight:10}}>{this.props.right}</Text>
                    <Image style={{width: 5, height: 8}} source={require('../../images/jt.png')}
                           resizeMode={'stretch'}/>
                </View>
            </TouchableNativeFeedback>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        height: 45,
        flexDirection: 'row',
        alignItems: 'center',
        backgroundColor: 'white',
    },
});
